from django.shortcuts import render
from entrance.models import Department, ButtonClick


def entrance_page(request):
    return render(request, "entrance.html")

def main_page(request):
    names = Department.objects.all()
    context = {'names': names}
    return render(request, "main.html", context)

def button_click_view(request, button_name):
    if request.method == 'POST':
        button_click = ButtonClick.objects.create(button_name=button_name),
        return render(request, 'success.html')
    else:
        return render(request, 'button.html')